const pkg = require('./package')

const rem = `
!function (n, w) {
  var e = n.document,
    t = e.documentElement,
    o = "orientationchange" in n ? "orientationchange" : "resize",
    a = function () {
      var n = t.clientWidth || w;
      n > w && (n = w);
      t.style.fontSize = n / w * 100 + 'px';
    };
  e.addEventListener && (n.addEventListener(o, a, !1), e.addEventListener('DOMContentLoaded', a, !1));
}(window, 750);
`

module.exports = {
  mode: 'universal',
  /*
  ** Headers of the page
  */
  head: {
    title: '人人宴',
    meta: [
      { charset: 'utf-8' },
      {
        name: 'viewport',
        content:
          'width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0'
      },
      { hid: 'description', name: 'description', content: pkg.description }
    ],
    link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
    script: [
      { innerHTML: rem, type: 'text/javascript', charset: 'utf-8' },
      { src: 'https://ssl.captcha.qq.com/TCaptcha.js' }
    ],
    __dangerouslyDisableSanitizers: ['script']
  },

  /*
   ** Customize the progress-bar color
   */
  loading: { color: '#ff1d41' },

  styleResources: {
    scss: '@/assets/css/variables.scss'
  },

  /*
  ** Global CSS
  */
  css: ['@/assets/css/index.scss', 'swiper/dist/css/swiper.css'],

  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
    { src: '~plugins/vue-awesome-swiper.js', ssr: false }, // swiper
    // { src: '~plugins/photoSwipe.js', ssr: false }, // 图片预览插件
    { src: '~plugins/statistics.js', ssr: false }, // 统计
    { src: '~plugins/$tencentCaptcha.js', ssr: false }, // 腾讯验证二维码
    '~plugins/$http.js', // http请求
    '~plugins/$bus.js',
    '~plugins/utils.js'
  ],

  /*
  ** Nuxt.js modules
  */
  modules: ['@nuxtjs/style-resources'],

  /*
  ** Build configuration
  */
  build: {
    /*
    ** You can extend webpack config here
    */
    extend(config, ctx) {}
  }
}
